import {request} from '../request';
import Page = Api.Common.Page;

export function fetchRoleMenus(roleId: number) {
  return request<Api.SystemManage.Menu[]>({
    url: '/menu/getRoleMenus/' + roleId,
    method: 'get',
    data: {}
  });
}

export function fetchAllMenu() {
  return request<Api.SystemManage.MenuResult>({
    url: '/menu/getAllMenus',
    method: 'post',
    data: {}
  });
}

export function fetchUpdateMenu(params?: Api.SystemManage.Menu) {
  return request<any>({
    url: '/menu/update',
    method: 'post',
    data: params
  });
}


//获取配置
export const getSysConfig = async (params: any) => {
  return await request<Api.Entity.Config[]>({
    url: '/sys-config/getAllConfig',
    method: 'post',
    data: params
  });
}
//修改配置
export const updateSysConfig = async (params: any) => {
  return await request<any>({
    url: '/sys-config/updateConfig',
    method: 'post',
    data: params
  });
}
// 获取存储配置
export const getStorageConfig = async (params: Api.Common.Pageable) => {
  return await request<Page<Api.Storage.Config>>({
    url: '/sys-config/storage-config-list',
    method: 'post',
    data: params
  });
}
// 更新存储配置
export const saveStorageConfig = async (params: Api.Storage.Config) => {
  return await request<any>({
    url: '/sys-config/save-storage-config',
    method: 'post',
    data: params
  });
}
